namespace NBody.Analysis
{
    using System;
    using DataFile;
    
    public class EnergyBinDF : EnergyBin
    {
        public override void Analyse(NBodySystem s)
        {
            Console.Error.WriteLine("Calculating f(E) (radial orbits)");
            
            EnergyBin dmde = new EnergyBinDMDE();
            dmde.NumBins = n;
            dmde.BinOrbit = orbit;
            dmde.Analyse(s);
            
            EnergyBin dos = new EnergyBinDOS();
            dos.NumBins = n;
            dos.BinOrbit = orbit;
            dos.Analyse(s);
            
            data = new Table(n, 2, "Distribution function f(E)");
            for (int i = 0; i < n; i++)
            {
                data[i, 0] = dmde.Data[i, 0];
                data[i, 1] = dmde.Data[i, 1] / dos.Data[i, 1];
            }                
        }
    }
}
